<?php

/**
 * @author      Nguyen Duc Thuan <me@ndthuan.com>
 * @copyright   Copyright (c) 2009 Nguyen Duc Thuan <me@ndthuan.com>
 * @version     $Id: DateTime.php 12 2009-11-03 03:17:46Z thuan.nguyen $
 */

class Fete_DateTime
{
    /**
     * Get UNIX timestamp by timezone offset
     * @param integer $hoursOffset
     * @param integer $timestamp
     * @return integer timestamp
     */
    static public function getGmtTime($hoursOffset = 0, $timestamp = null)
    {
        if (null === $timestamp) {
            $timestamp = time();
        }

        $gmtstamp = strtotime(gmdate('Y-m-d H:i:s', $timestamp));

        if (0 === $hoursOffset) {
            return $gmtstamp;
        }

        return $gmtstamp + $hoursOffset*3600;
    }
}